import Vue from 'vue'
import App from './App'
import router from './router/index'
import store from './store/main'
import * as filters from './common/filter/common-filter'
import * as vueExpand from './common/vue-expand-func'
import VueLazyLoad from 'vue-lazyload'
import './config/ui/iview-components'
import VueI18n from 'vue-i18n'

Vue.use(VueI18n)

Vue.use(VueLazyLoad, {
  error: '/static/images/error.jpg',
  loading: '/static/images/loading.gif'
})


/**
 * 生成 Vue 过滤器
 */
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});

/**
 * 生成常用方法
 */
Object.keys(vueExpand).forEach(key => {
  Vue.prototype[key] = vueExpand[key]
});

new Vue({
  el: '#app',
  router,
  store,
  components: {App},
  template: '<App/>',
  mounted() {
  },
  created() {

  }
})

window.onerror = function (msg, url, l) {
  let txt = "There was an error on this page.\n\n"
  txt += "Error: " + msg + "\n"
  txt += "URL: " + url + "\n"
  txt += "Line: " + l + "\n\n"
  txt += "Click OK to continue.\n\n"
  //alert(txt)
  return true
}
